package com.teach.mapper;

import java.util.Collection;
import java.util.List;

import org.apache.ibatis.annotations.Update;
import org.springframework.data.repository.query.Param;

import com.teach.dto.PhotoTriggerUserDTO;
import com.teach.entity.PhotoFav;

public interface PhotoFavMapper {
    int deleteByPrimaryKey(Long photoFavId);

    int insert(PhotoFav record);

    int insertSelective(PhotoFav record);

    PhotoFav selectByPrimaryKey(Long photoFavId);

    int updateByPrimaryKeySelective(PhotoFav record);

    int updateByPrimaryKey(PhotoFav record);
    
    /**
     * 查询收藏人的 用户名 头像 收藏时间
     * @param pictureIds
     * @param username
     * @param status
     * @return
     */
    List<PhotoTriggerUserDTO> selectCollectInform(@Param(value = "pictureIds")Collection<Long> pictureIds, @Param(value = "username") String username, @Param(value = "status") String status);

    
    @Update("UPDATE photo_fav SET photo_fav_status = #{status},photo_fav_time = now() WHERE photo_pic_id = #{picId} AND photo_fav_user_id = #{userId}")
    int updateStatus(
    		@Param("status")String status,
    		@Param("picId")Long picId,
    		@Param("userId")String userId);
}